//package com.tcm.portal.web.controller;
//
//import cn.hutool.core.util.ObjectUtil;
//import com.base.core.utils.R;
//import com.tcm.doctor.domain.vo.DoctorExtractVo;
//import com.tcm.doctor.service.DoctorCashDrawsService;
//import com.tcm.pay.domain.dto.TransferFixedDTO;
//import com.tcm.pay.service.TransfeService;
//import org.apache.dubbo.config.annotation.Reference;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.RestController;
//
///**
// * 代付接口
// */
//@RequestMapping("/pay")
//@RestController
//public class TransfeController {
//
//    @DubboReference(version = "0.0.1-alpha", check = false, timeout = 3000)
//    private TransfeService transfeService;
//
//    @DubboReference(version = "0.0.1-alpha", check = false, timeout = 3000)
//    private DoctorCashDrawsService doctorExtractService;
//
//    /**
//     * 代付
//     *
//     * @param id
//     * @return
//     * @throws Exception
//     */
//    @GetMapping("/transfe/doctor-extract")
//    public R transfe(@RequestParam("id") Long id) throws Exception {
//
//        DoctorExtractVo doctorExtractVo = doctorExtractService.findById(id);
//
//        if(ObjectUtil.isNull(doctorExtractVo)){
//            return R.fail("订单不存在");
//        }
//
//        TransferFixedDTO transferFixedDTO = new TransferFixedDTO();
//        transferFixedDTO.setTransId(id.toString());
//        transferFixedDTO.setTt(doctorExtractVo.getTt().toString());
//        transferFixedDTO.setBankCode(doctorExtractVo.getBankCode());
//        transferFixedDTO.setProvice(doctorExtractVo.getProvice());
//        transferFixedDTO.setCity(doctorExtractVo.getCity());
////        transferFixedDTO.setBranchName("上海市闸北区支行");
//        transferFixedDTO.setAccountName(doctorExtractVo.getAccountName());
//        transferFixedDTO.setCardNo(doctorExtractVo.getCardNo());
//        transferFixedDTO.setAmount(doctorExtractVo.getExtractPrice().toString());
//        transferFixedDTO.setRemark("");
////        transferFixedDTO.setIdNo("362322196905306318");
////        transferFixedDTO.setPhone("13818631238");
//        return R.success(transfeService.transferFixed(transferFixedDTO));
//    }
//
//    /**
//     * 代付回调
//     *
//     * @return
//     * @throws Exception
//     */
//    @RequestMapping("/transfe/notify")
//    public String notify(@RequestParam(name = "MerNo", value = "") String merNo,
//                         @RequestParam(name = "Amount", value = "") String amount,
//                         @RequestParam(name = "BillNo", value = "") String billNo,
//                         @RequestParam(name = "MerBillNo", value = "") String merBillNo,
//                         @RequestParam(name = "CardNo", value = "") String cardNo,
//                         @RequestParam(name = "Result", value = "") String result,
//                         @RequestParam(name = "Succeed", value = "") String succeed,
//                         @RequestParam(name = "SignInfo", value = "") String signInfo) throws Exception {
//
////        String content = "MerNo:" + merNo + "\nAmount:" + amount + "\nBillNo:" + billNo + "\nMerBillNo:" + merBillNo +
////                "\nCardNo:" + cardNo + "\nAmounResult:" + result + "\nSucceed:" + succeed + "\nSignInfo:" + signInfo;
////        FileUtils.writeToFile("/logs/tcm-pay-transfe.log", content, true);
//
//        try {
//            if (ObjectUtil.isNotNull(succeed) && succeed.equals("00")) {
//                //提现成功
//                doctorExtractService.success(merBillNo, billNo);
//
//                return "ok";
//            } else if (ObjectUtil.isNotNull(succeed) && succeed.equals("11")) {
//                //提现退回
//                doctorExtractService.fail(merBillNo, billNo);
//
//                return "ok";
//            }
//        }catch (Exception exception){
//            return exception.toString();
//        }
//        return "fail";
//    }
//
//}
